# coding=utf-8


import json
import rabbitmq

# 建立连接
connection = rabbitmq.get_connection("10.86.3.178",5672,"admin","msdi@rabbit")

# 创建管道
channel = connection.channel()
# queueName='GJLZHFJYXT'
# 创建队列
queue_name = "GJLZHFJYXT"
result = channel.queue_declare(queue=queue_name)

user={"id": "2DD62BC85B7D49B0AD2B7DD16A32809A", "comFax": "0871-65660628", "account": "", "comAddr": null, "comCode": "91530000676581175P", "comName": "云南滇能智慧能源有限公司", "comType": "01", "imgName": "companyCard/10c64a14e92c494798d68e5dce72ecb7.jpg", "addrCity": "昆明市", "codeType": "01", "comGroup": "", "comPhone": "0871-65660617", "parentId": "00000000000000000000000000000001", "comNatuke": "其他有限责任公司", "isDefault": 0, "isDeleted": "0", "addrCounty": "五华区", "auditState": 3, "createTime": "2023-08-07 00:00:00.000000", "createUser": "0", "dataSource": "tongyirenzheng", "updateTime": "2024-07-16 15:24:53.000000", "updateUser": "-1", "imgAuthName": "other/20240716_151857960.png", "addrProvince": "云南省", "codeTypeName": "营业执照", "fullParentId": "00000000000000000000000000000001,00000000000000000000000000000001"}
# 向队列中写入数据
rabbitmq.send_json(channel, user, queue=result)

# # 向队列中写入数据
# data = [
#     {"id": 1, "name": "张三", "age": 23},
#     {"id": 2, "name": "李四", "age": 24},
#     {"id": 3, "name": "王五", "age": 35},
# ]
# for user in data:
#     rabbitmq.send_json(channel, user, queue=result)

# 关闭连接
connection.close()